<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <title>我的预约明细</title>
    <link rel="stylesheet" href="<c:url value='/resource/wechat/css/frozen.css'></c:url>">
    <link rel="stylesheet" href="<c:url value='/resource/wechat/css/main.css'></c:url>">
    <style>
        .ui-border-b {
            border-bottom: 1px solid #e0e0e0;
        }

        .ui-form-item {
            position: relative;
            font-size: 16px;
            height: auto;
            min-height: 44px;
            line-height: 24px;
            padding: 5px 15px;
        }

        .ui-form-item label {
            padding: 10px 0;
        }

        .ui-form-item p {
            padding: 10px 0 10px 95px;
            word-break: break-all; /*支持IE，chrome，FF不支持*/
            　　word-wrap: break-word; /*支持IE，chrome，FF*/
        }
    </style>
</head>

<body class="body_bg" ontouchstart>
<section class="ui-container">

    <div class="ui-form-item ui-form-item-show ui-border-b bg_fff">
        <label for="#">预约编号：</label>
        <p>${projectInfo.orderno}</p>
    </div>
    <div class="ui-form-item ui-form-item-show ui-border-b bg_fff">
        <label for="#">事项名称：</label>
        <p>${projectInfo.orderMatName}</p>
    </div>
    <div class="ui-form-item ui-form-item-show ui-border-b bg_fff">
        <label for="#">预约状态：</label>
        <%--<p>${projectInfo.state}</p>--%>
        <p>${projectInfo.state=="0" ? "未受理" : projectInfo.state=="1" ? "已受理" : "已撤销"}</p>
    </div>
    <%--    <div class="ui-form-item ui-form-item-show ui-border-b bg_fff">
          <label for="#">预约方式：</label>
         <p>${yyPrjInfo.netProjectType}</p>
        </div>--%>
    <div class="ui-form-item ui-form-item-show ui-border-b bg_fff">
        <label for="#">申报时间：</label>
        <p>${projectInfo.creatordate}</p>
    </div>
    <div class="ui-form-item ui-form-item-show ui-border-b bg_fff">
        <label for="#">预约时间：</label>
        <p>${projectInfo.orderDay} ${projectInfo.orderDayStart}~${projectInfo.orderDayEnd}</p>
    </div>

    <div class="ui-form-item ui-form-item-show ui-border-b bg_fff">
        <label for="#">受理部门：</label>
        <p>${projectInfo.orderDeptName}</p>

    </div>
    <input type="hidden" id="userName" value="${projectInfo.realname}">
    <input type="hidden" id="projectBillid" value="${projectInfo.orderMatId}">
    <input type="hidden" id="loginId" value="${projectInfo.creator}">

<%--    <div id="revokeBtn" class="ui-btn-wrap" style="margin-top: 20px; display: none">
        <a id="revoke" class="ui-btn-lg ui-btn-primary">预约撤销</a>
    </div>--%>
    <button class="ui-btn-lg ui-btn-primary" style="display: none" id="revokeBtn">
        预约撤销
    </button>

</section>
</body>
<script src="<c:url value='/resource/js/jquery-2.0.min.js'/>"></script>
<script src="<c:url value='/resource/static/plugins/js/common.js'/>"></script>
<script>

    $(function () {
        var status = ${projectInfo.state};
        if (status == "0") {
            $("#revokeBtn").css("display", "block");
        }

        $("#revokeBtn").click(function () {
            <%--$(this).children("a:first").attr("href","<c:url value='/api/police/revoke/${projectInfo.guid}'/>");--%>
            $.ajax({
                url: "<c:url value='/api/police/revoke/${projectInfo.guid}'/>",
                beforeSend: function () {
                    $("#revokeBtn").attr("disabled", true);
                },
                success: function (rep) {
                    if (rep.succ) {
                        alert("预约撤销成功!!");
                        setTimeout(function () {
                            window.location.href = "<c:url value='/api/police/myorder' />";
                        }, 200);
                    } else {
                        alert("预约撤销失败!!");
                        $("#revokeBtn").removeAttr("disabled");
                    }
                }
            })

        })
    });

</script>
</html>